package com.test.springai.config;

import com.test.springai.service.LocalFileMcpService;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 *
 * @description:
 * @author: liuziyang
 * @since: 8/22/25 5:06 PM
 * @modifiedBy:
 * @version: 1.0
 */
@Configuration
public class McpConfig {
  /**
   * Local file search tools tool callback provider. 定义一个 ToolCallbackProvider Bean，用于向 AI
   * 模型提供可调用的工具 它将 LocalFileMcpService 中定义的所有@Tool方法注册为工具
   *
   * @param localFileMcpService the local file mcp service
   * @return the tool callback provider
   */
  @Bean("localFileSearchTools")
  public ToolCallbackProvider localFileSearchTools(LocalFileMcpService localFileMcpService) {
    return MethodToolCallbackProvider.builder().toolObjects(localFileMcpService).build();
  }
}
